package com.craiglarman.monopoly.domain;

public class Player {
	
	private Square currentSquare;
	
	

	private Die dice1;
	private Die dice2;
	private Board board;
	public Board getBoard() {
		return board;
	}

	public void setBoard(Board board) {
		this.board = board;
	}

	private int diceTotal;
	private int cash;

	public Player(Board board, Die dice1, Die dice2)
	{
		currentSquare=board.getFirstSquare();
		this.board=board;
		this.dice1=dice1;
		this.dice2=dice2;
		this.cash=1500;
	}
	
	private void setCurrentSquare(Square nextSquare)
	{
		this.currentSquare = nextSquare;
	}

	public Square getCurrentSquare()
	{
		return currentSquare;
	}
	
	public void takeTurn() 
	{
		dice1.roll();
		dice2.roll();
		diceTotal=dice1.getFaceValue()+dice2.getFaceValue();
		Square nextSquare = board.getSquare(currentSquare, diceTotal);
		setCurrentSquare(nextSquare);
	}

	public String getDiceTotal() {
		return ""+diceTotal;
	}

	public void addCash(int cashToAdd) {
		this.cash+=cashToAdd;
	}

	public Object getCash() {
		return cash;
	}

	public void subCash(int tax) {
		cash-=tax;
		
	}

	public int getNetWorth() {
		return cash;
	}

	public void setPos(Square newSquare) {
		currentSquare=newSquare;
	}
}
